package com.ws.boot.demo.validate.service.custom.impl;

import com.ws.boot.demo.validate.entity.IdCard3;
import com.ws.boot.demo.validate.entity.Person3;
import com.ws.boot.demo.validate.service.custom.CustomValidatorService;
import com.ws.boot.demo.validate.validation.annotation.Unique;
import com.ws.boot.validate.annotation.constraint.Checker;
import com.ws.boot.web.domain.DefaultResponse;
import org.springframework.stereotype.Service;

/**
 * 自定义校验器业务类 实现类 .
 *
 * @className: CustomValidatorServiceImpl
 * @author: ws
 * @date: 2020/4/8 15:38
 * @version: 1.0.0
 */
@Service
public class CustomValidatorServiceImpl implements CustomValidatorService {

    /**
     * 自定义校验一层 .
     *
     * @param idCard3
     * @return Response
     * @author ws
     * @date 2020/4/8 15:36
     **/
    @Override
    public DefaultResponse checkerOneLevel(@Checker IdCard3 idCard3) {
        return DefaultResponse.success();
    }

    /**
     * 自定义校验两层 .
     *
     * @param person3
     * @return Response
     * @author ws
     * @date 2020/4/8 15:38
     **/
    @Override
    public DefaultResponse checkerTwoLevel(@Checker Person3 person3) {
        return DefaultResponse.success();
    }

    /**
     * 上下文 .
     *
     * @param code
     * @param name
     * @return Response
     * @author ws
     * @date 2020/4/13 16:13
     **/
    @Override
    public DefaultResponse context(@Unique String code, @Unique String name) {
        return DefaultResponse.success();
    }
}
